<template>
  <div class="first-nav clearfix">
    <ul class="clearfix">
      <li class="li clearfix" v-for="(item, index) in menuList" :key="index">
        <a class="nav" :class="{active:item.name == acticeName}" href="javascript:;" :title="item.title" @click="handleClick(item)" v-if="!item.hideInMenu">{{item.title}}</a>
      </li>
    </ul>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data() {
    return {}
  },
  computed: {
      ...mapState({
        menuList: state => state.menuList,
        acticeName: state => state.menuIndexData.pName,
      })
  },
  mounted() {
  },
  methods: {
    handleClick(item){
      let name = item.name
      if(name === "home") {
        name = "home_index"
      }
      // console.log(item.name)
      this.$router.push({name:name})
    }
  }
}
</script>

<style lang="scss" scoped>
@import '@/styles/base.scss';
.li {
  float: left;
}
.nav {
  float: left;
  // width: 69px;
  padding: 0 15px;
  text-align: center;
  line-height: 72px;
  color: #F3F3F3;
  font-size: 14px;
  &:hover {
    color: #fff;
  }
}
.active {
  color: #191919;
  background: #fff;
  &:hover {
    color: #191919;
  }
}
</style>